package com.zcxy.fast.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 构建 Vue路由
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "vue菜单对象", description = "vue菜单对象")
public class VueRouter<T> implements Serializable {

    private static final long serialVersionUID = -3327478146308500708L;

    @JsonIgnore
    private String id;
    @JsonIgnore
    private String parentId;

    @ApiModelProperty(value = "路径")
    private String path;

    @ApiModelProperty(value = "别名")
    private String alias;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "组件")
    private String component;

    @ApiModelProperty(value = "默认跳转")
    private String redirect;

    @ApiModelProperty(value = "默认跳转")
    private String sysType;

    private RouterMeta meta;

    private Boolean hidden = false;

    private Boolean alwaysShow = false;

    @ApiModelProperty(value = "子菜单")
    private List<VueRouter<T>> children;

    @JsonIgnore
    private Boolean hasParent = false;

    @JsonIgnore
    private Boolean hasChildren = false;

    public void initChildren() {
        children = new ArrayList<>();
    }

}
